package com.feicheng.controller.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.common.exception.SystemException;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.persistence.entity.About;
import com.feicheng.service.IFAboutService;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuxiuwen
 * @since 2022-02-17
 */
@RestController
@RequestMapping("/admin/about")
public class AboutController {

	@Autowired
	IFAboutService aboutService;
	
	
	@GetMapping("/info")
	public ResultInfo getAbout(Integer aboutId) {
		
		
		//返回获取的about表中的详情信息
		
		return aboutService.getAbout(aboutId);
	}
	
	
	@PutMapping("/info")
	public ResultInfo updataAbout(About about) {
		
		//如果获取的about表主键about_id为空
		//则抛出SystemException异常
		if (null == about.getAboutId()) {
			throw new SystemException("分类主键缺失");
		}
		
		
		
		
		//返回更改的about表中的详情信息
		return aboutService.updataAbout(about);
		
		
		
	}

	
}
